<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户列表</title>
    <link rel="stylesheet" href="../assets/lib/layui/css/layui.css">
</head>

<body>
    <div class="layui-card">
        <div class="layui-card-header">用户列表</div>
        <div class="layui-card-body">
            <!-- 表格主体 start -->
            <table class="layui-table">
                <colgroup>
                    <col width="15%">
                    <col width="20%">
                    <col width="20%">
                    <col width="20%">
                    <col>
                </colgroup>
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>账号名称</th>
                        <th>昵称</th>
                        <th>邮箱</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <!-- 用户列表区 -->
                </tbody>
            </table>
            <!-- 表格主体 end -->

            <!-- 页码区-->
            <div id="page"></div>
        </div>
    </div>

    <!-- 模板引擎 - 用户列表区 start -->
    <script type="text/html" id="tpl-user">
    {{each data}}
    <tr>
        <td>{{$value.id}}</td>
        <td>{{$value.username}}</td>
        <td>{{$value.nickname}}</td>
        <td>{{$value.email}}</td>
        <td>
            <button type="button" class="layui-btn layui-btn-sm" href="../user/edituser.html" data-id="{{$value.id}}">编辑</button>
            <button type="button" class="layui-btn layui-btn-sm layui-btn-danger" data-id="{{$value.id}}">删除</button>
            <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" data-id="{{$value.id}}">重置密码</button>
        </td>
    </tr>
    {{/each}}
    </script>
    <!-- 模板引擎 - 用户列表区 end -->

    <!-- 模板引擎 - 编辑用户弹出层 start -->
    <script type="text/html" id="tpl-edit">
        <form class="layui-form edituser" action="" lay-filter="edit" style="padding:20px">
        <!-- 用户名 -->
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="username" required lay-verify="required" placeholder="请输入用户名"
                    autocomplete="off" class="layui-input" disabled>
            </div>
        </div>
        <!-- 昵称 -->
        <div class="layui-form-item">
            <label class="layui-form-label">昵称</label>
            <div class="layui-input-block">
                <input type="text" name="nickname" required lay-verify="required" placeholder="请输入昵称"
                    autocomplete="off" class="layui-input">
            </div>
        </div>
        <!-- 邮箱 -->
        <div class="layui-form-item">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-block">
                <input type="text" name="email" required lay-verify="required|email" placeholder="请输入邮箱"
                    autocomplete="off" class="layui-input">
            </div>
        </div>
        <!-- 提交和重置按钮 -->
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="text" name="id" style="display:none">
                <button class="layui-btn" lay-submit lay-filter="formDemo" id="addBtn">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
    </script>
    <!-- 模板引擎 - 编辑用户弹出层 end -->

    <!-- 模板引擎 - 重置密码弹出层 start -->
    <script type="text/html" id="tpl-pwd">
        <form class="layui-form repwd" action="" style="padding:20px">
            <div class="layui-form-item">
                <label class="layui-form-label">新密码</label>
                <div class="layui-input-block">
                    <input type="password" name="password" required lay-verify="required|pass" placeholder="请输入新密码"
                        autocomplete="off" class="layui-input newpwd">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">确认密码</label>
                <div class="layui-input-block">
                    <input type="password" required lay-verify="required|same" placeholder="请确认新密码"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </script>
    <!-- 模板引擎 - 重置密码弹出层 end -->

    <!-- 加载js文件 -->
    <script src="../assets/lib/jquery.js"></script>
    <script src="../assets/lib/template-web.js"></script>
    <script src="../assets/lib/layui/layui.all.js"></script>
    <script src="../assets/js/common.js"></script>
    <script src="../assets/js/user/user.js"></script>
</body>

</html>